
/**
 * Write a description of class ForecastDisplay here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ForecastDisplay implements Observer, DisplayElement
{
    private float pressure = 29.92f;
    private float lastPressure;
    private Subject weatherData;
    
    public ForecastDisplay(Subject weatherData){
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }
    
    public void update(float temperature, float humidity, float pressure){
        this.lastPressure = this.pressure;
        this.pressure = pressure;
        display();
    }
    
    public void display(){
        if(pressure > lastPressure){
            System.out.println("Improving weather on the way!");
        }else if(pressure < lastPressure){
            System.out.println("Watch out for cooler, raining weather");
        }else if(pressure == lastPressure){
            System.out.println("More of the same");
        }
    }
}
